<!DOCTYPE html>
<html>
  <head>
    <meta name="viewport" content="width=device-width, initial-scale=1" charset="utf-8">
    <link rel="stylesheet" href="../javascripts/lib/jqm/jquery.mobile-1.4.3.min.css"/>
    <link rel="stylesheet" href="../stylesheets/main.css"/>
    <script src="../javascripts/lib/jq/jquery-2.1.1.min.js"></script>
    <script src="../javascripts/lib/jqm/jquery.mobile-1.4.3.min.js"></script>
      <script type="text/javascript">
          $(function() {
              $( ".selector" ).page({ domCache: false });
          })
      </script>
    <title><%=title%></title>
  </head>
  <body>
    <div class="a" data-role="page" id="msgListPage" data-dom-cache="false">
      <div data-role="header" id="header">
          <a class="ui-btn ui-btn-inline ui-icon-delete ui-btn-icon-left" id="wcback" href="#">关闭</a>
          <h1>查看历史记录</h1>
      </div>
      <div data-role="content" data-theme="c" >
          <script type="text/javascript">
              var totalheight = 0;     //定义一个总的高度变量
              function loaata()
              {alert('sssssssss');
                  totalheight = parseFloat($(window).height()) + parseFloat($(window).scrollTop());     //浏览器的高度加上滚动条的高度

                  if ($(document).height() <= totalheight)     //当文档的高度小于或者等于总的高度的时候，开始动态加载数据
                  {
                      //加载数据
                      var content = "<li><a href=\"#\">这是加载的数据</a></li>";
                      $("#listview").append(content).listview('refresh');

                  }
              }

            /*  $(window).scroll( function() {
                  alert('sssssssss');
                  console.log("滚动条到顶部的垂直高度: "+$(document).scrollTop());
                  console.log("页面的文档高度 ："+$(document).height());
                  console.log('浏览器的高度：'+$(window).height());
                  loaata();
              });*/
              $(function() {
                  $("#btnMore").click(function() {
                      //alert('sssssssss');
                      loadData();
                  });
              });
              function loadData(){
                  var content = "<li><a href=\"#\">这是加载的数据</a></li>";
                  $("#listview").append(content).listview('refresh');
              }
              $("#wcback").click(function(){
                  WeixinJSBridge.call('closeWindow');//微信内置浏览器关闭当前页面
              });

              $(function(){
                  alert('ssssssxxxxsss');

              });

          </script>
          <div class="orderlistdes">
              <a href="/wcpay/orderlist">服务记录</a>
          </div>
          <div class="balance" style="color: #00B2EE;">
            聊天记录共&nbsp;<%=count%>&nbsp;条
          </div>
          <div style="width: 100%">
          <ul id="listview" data-role="listview" data-inset="true" >
          <%if(msgList.length>0){%>
              <%msgList.forEach(function(msg){%>
                <li>
                  <!--<div class="gridrow">-->
                    <!--<label>提问主题：</label>
                    <label>对方名称：</label>
                    <label>对话时间：</label>-->
                  <!--</div>-->
                    <div style="width: 100%">
                        <div style="width: 25%; white-space:pre-wrap; float: left">提问主题：</div>
                        <div style="width: 70%; white-space:pre-wrap; float: left" >

                        <%if(msg.msgtype=='image'){%>
                        <h3>[图片]</h3>
                        <%}else{%>
                        <h3><%=msg.sendcontent%></h3>
                        <%}%>
                        </div>
                        <div style="width: 25%; white-space:pre-wrap; float: left">对方名称：</div>
                        <div style="width: 58%; float: left"><%=msg.nickname%></div><div  style="width: 12%; float: left; color: #008B00;"><%if(msg.publicChat!=0){%>已公开<%}else{%>未公开<%}%></div>
                        <div style="width: 25%; white-space:pre-wrap; float: left">对话时间：</div>
                        <div style="width: 75%; float: left"><%=msg.date%><div style="float: right"><a href="/view/chatDetail?sid=<%=msg.wcsessionid%>&oid=<%=oid%>&openid=<%=openid%>&ispub=<%=msg.publicChat%>" style="color: #00B2EE;">查看详细</a></div></div>
                    </div>


                </li>
              <%});%>
          <%}else{%>
            <li><div class="noorder">
              您目前没有会话记录!
            </div></li>
          <%}%>
          </ul>
              <div id="moreDiv">
                  <button id="btnMore" data-icon="refresh">
                      显示更多
                  </button>
              </div>

          </div>
      </div>
    </div>
  </body>
</html>